package com.cas.authentication;

import org.apereo.cas.authentication.UsernamePasswordCredential;

import java.util.Objects;

/**
 * 参考 {@link org.apereo.cas.authentication.UsernamePasswordCredential}
 * 参考 {@link org.apereo.cas.authentication.RememberMeUsernamePasswordCredential}
 *
 */
public class CustUsernamePasswordCredential extends UsernamePasswordCredential {

    private static final long serialVersionUID = 1767227441947916650L;

    private String captcha;

    public CustUsernamePasswordCredential() {
    }

    public CustUsernamePasswordCredential(String userName, String password, String captcha) {
        super(userName, password);
        this.captcha = captcha;
    }

    public String getCaptcha() {
        return captcha;
    }

    public void setCaptcha(String captcha) {
        this.captcha = captcha;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof CustUsernamePasswordCredential)) return false;
        if (!super.equals(o)) return false;
        CustUsernamePasswordCredential that = (CustUsernamePasswordCredential) o;
        return Objects.equals(getCaptcha(), that.getCaptcha());
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), getCaptcha());
    }
}
